﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using math.DataAccess;
using math.DTOs;

namespace math.Facades
{
    public class StudentFacade
    {
        private string GetName(StudentInfo studInfo)
        {
            var sname = studInfo.Name;
            if (studInfo.Age > 20)
            {
                sname += " old";
            }
            else
            {
                sname += " new";
            }
            return sname;
        }
        public bool SaveStudent(StudentInfo studInfo, bool isExternal)
        {
            bool success = true;
            try
            {
                studInfo.Name = GetName(studInfo);
                Queries queries = new Queries();
                queries.SaveStudent(studInfo);
                queries.DBSubmit();
            }
            catch (Exception)
            {
                success = false;
            }
            return success;
        }
    }
}
